import akka.actor.AbstractActor;
import akka.actor.PoisonPill;
import akka.actor.UntypedAbstractActor;

public class MyActorB extends UntypedAbstractActor {
//    @Override
//    public Receive createReceive() {
//        return receiveBuilder().match(String.class,result->{
//            if (result.equalsIgnoreCase("stop")){
////                getContext().stop(getSelf());
//                getSelf().tell(PoisonPill.getInstance(), getSelf());
//            }
//            System.out.println("Actor B 接收到消息：" + result);
//        }).build();
//    }

    @Override
    public void onReceive(Object message) throws Throwable {
        if (message instanceof String && message.equals("stop")) {
            getSelf().tell(PoisonPill.getInstance(), getSelf());
        }
        System.out.println(message);
    }
}
